#include "images.h"
#include "model/pieces/allpieces.h"

namespace view
{
    namespace piece
    {
        const QImage kingL(":/KingL"), kingD(":/KingD"), queenL(":/QueenL"), queenD(":/QueenD"), knightL(":/KnightL"), knightD(":/KnightD"),
             rookL(":/RookL"), rookD(":/RookD"), bishopL(":/BishopL"), bishopD(":/BishopD"), pawnL(":/PawnL"), pawnD(":/PawnD");

        const QImage* getPieceImage(const globals::cPiece& piece)
        {
            if (piece)
            {
                if (typeid(*piece) == typeid(model::piece::King))
                    return piece->isLight ? &kingL : &kingD;
                else if (typeid(*piece) == typeid(model::piece::Queen))
                    return piece->isLight ? &queenL : &queenD;
                else if (typeid(*piece) == typeid(model::piece::Knight))
                    return piece->isLight ? &knightL : &knightD;
                else if (typeid(*piece) == typeid(model::piece::Rook))
                    return piece->isLight ? &rookL : &rookD;
                else if (typeid(*piece) == typeid(model::piece::Bishop))
                    return piece->isLight ? &bishopL : &bishopD;
                else if (typeid(*piece) == typeid(model::piece::Pawn))
                    return piece->isLight ? &pawnL : &pawnD;
            }
            return NULL;
        }
    }
}
